import Vue from 'vue'
import Router from 'vue-router'
import store from './store'
Vue.use(Router)



import Index from './views/Index.vue'
import Login from './views/Login.vue'
import Register from './views/Register.vue'
import NotFound from './views/errorPage/404.vue'

//主页
import dashboard from './views/dashboard/dashboard.vue'

//公司管理
import frameworkSet from './views/company/frameworkSet.vue'
import staffManagement from './views/company/user/staffManagement.vue'

//系统管理
import role from './views/system/role/role.vue'
import region from './views/system/region.vue'
import menu from './views/system/menu.vue'
import dictionaries from './views/system/dictionaries.vue'
import classify from './views/system/classify.vue'
import label from './views/system/label.vue'
import serviceCharge from './views/system/serviceCharge.vue'
import parameterSet from './views/system/parameterSet.vue'
import loginLog from './views/system/loginLog.vue'
import activeLog from './views/system/activeLog.vue'
import clientVersionUpdate from './views/system/clientVersionUpdate.vue'

//商品管理
import shopSearch from './views/shop/shopSearch.vue'
import shopAudit from './views/shop/shopAudit.vue'
import shopAuditDetails from './views/shop/shopAuditDetails.vue'
import goodPresent from './views/shop/goodPresent.vue'
import editShop from './views/shop/editShop.vue'
import shopDetail from './views/shop/shopDetail.vue'
import applyGoodShop from './views/shop/applyGoodShop.vue'
import shopOperation from './views/shop/shopOperation.vue'
import shopOperationNow from './views/shop/shopOperationNow.vue'
import evaluate from './views/shop/evaluate.vue'
import evaluateList from './views/shop/evaluateList.vue'
import activityOperation from './views/shop/activityOperation.vue'
import activityOperationSet from './views/shop/activityOperationSet.vue'

//订单查询
import goodPresentOrder from './views/order/goodPresent.vue'
import goodStore from './views/order/goodStore.vue'
import cloudWarehouse from './views/order/cloudWarehouse.vue'
import scanQRCode from './views/order/scanQRCode.vue'
import cloudWarehouseOrderDetail from './views/order/cloudWarehouseOrderDetail.vue'
import orderDetail from './views/order/orderDetail.vue'

// 项目配置
import fromConfig from './views/projectConfig/fromConfig'


let router = new Router({
  mode: 'history',
  base: process.env.BASE_URL,
  routes: [
    {
      path: '/',
      component: Index,
      children: [
        {
          path: '/webClassify',
          name: 'webClassify',
          component: () => import('./views/WebClassify'),
          meta:{title:'前端字典数据查询',authority:true}
        },
        {
          path: '/dashboard',
          name: 'dashboard',
          component: dashboard,
          meta:{title:'首页',authority:true}
        },
        {
            path: "/activity/activityList",
            name: "activityList",
            meta: {
                title: '活动列表',
                authority:false
            },
            component: () => import('./views/activity/activityList')
        },
        {
            path: "/activity/addActivity",
            name: "addActivity",
            meta: {
                title: '新增活动',
                authority:true
            },
            component: () => import('./views/activity/addActivity')
        },
        {
            path: "/integral/integral",
            name: "integral",
            meta: {
                title: '积分商品列表',
                authority:false
            },
            component: () => import('./views/integral/integral')
        },
        {
            path: "/integral/integralRecord",
            name: "integralRecord",
            meta: {
                title: '积分商品兑换列表',
                authority:false
            },
            component: () => import('./views/integral/integralRecord')
        },
        {
          path: '/user/profile',
          name: 'profile',
          component: () => import('./views/company/user/profile/index'),
          meta:{title:'个人中心',authority:true}
        },
        {
            path: "/company/frameworkSet",
            name: "frameworkSet",
            meta: {
                title: '架构设置',
                authority:false //是否需要权限控制
            },
            component: frameworkSet,

        },
        {
            path: "/company/staffManagement",
            name: "staffManagement",
            meta: {
                title: '员工管理',
                authority:false
            },
            component: staffManagement
        },
        {
            path: "/company/authRole",
            name: "authRole",
            meta: {
                title: '分配角色',
                authority:true
            },
            component: () => import('./views/company/user/authRole')
        },
        {
            path: "/system/role",
            name: "role",
            meta: {
                title: '角色管理',
                authority:false
            },
            component: () => import('./views/system/role/role')
        },
        {
            path: "/system/roleAuth",
            name: "roleAuth",
            meta: {
                title: '分配用户',
                authority:true
            },
            component: () => import('./views/system/role/roleAuth')
        },

        {
            path: "/system/region",
            name: "region",
            meta: {
                title: '地区设置',
                authority:false
            },
            component: region
        },
        {
            path: "/system/menu",
            name: "menu",
            meta: {
                title: '菜单配置',
                authority:false
            },
            component: menu
        },
        {
            path: "/system/dictionaries",
            name: "dictionaries",
            meta: {
                title: '字典管理',
                authority:false
            },
            component: dictionaries
        },
        {
            path: "/system/dictionariesDetail",
            name: "dictionariesDetail",
            meta: {
                title: '字典数据',
                authority:true
            },
            component: () => import('./views/system/dictionariesDetail')
        },
        {
            path: "/system/classify",
            name: "classify",
            meta: {
                title: '分类管理',
                authority:false
            },
            component: classify
        },
        {
            path: "/system/label",
            name: "label",
            meta: {
                title: '标签管理',
                authority:false
            },
            component: label
        },
        {
            path: "/system/serviceCharge",
            name: "serviceCharge",
            meta: {
                title: '商家服务费',
                authority:false
            },
            component: serviceCharge
        },
        {
            path: "/system/parameterSet",
            name: "parameterSet",
            meta: {
                title: '参数设置',
                authority:false
            },
            component: parameterSet
        },
        {
            path: "/system/loginLog",
            name: "loginLog",
            meta: {
                title: '登录日志',
                authority:false //是否需要权限控制
            },
            component: loginLog
        },
        {
            path: "/system/activeLog",
            name: "activeLog",
            meta: {
                title: '操作日志',
                authority:false //是否需要权限控制
            },
            component: activeLog
        },
        {
            path: "/system/clientVersionUpdate",
            name: "clientVersionUpdate",
            meta: {
                title: '版本管理',
                authority:false //是否需要权限控制
            },
            component: clientVersionUpdate
        },

        /*商品管理*/
        {
            path: "/shop/shopSearch",
            name: "shopSearch",
            meta: {
                title: '商品查询',
                authority:false
            },
            component: shopSearch
        },
        {
            path: "/shop/shopDetail",
            name: "shopDetail",
            meta: {
                title: '商品详情',
                authority:true
            },
            component: shopDetail
        },
        {
            path: "/shop/shopDetails",
            name: "shopDetails",
            meta: {
                title: '商品详情',
                authority:true
            },
            component: () => import('./views/shop/shopDetails')
        },
        {
            path: "/shop/shopAudit",
            name: "shopAudit",
            meta: {
                title: '商品审核',
                authority:false
            },
            component: shopAudit
        },
        {
            path: "/shop/shopAuditDetails",
            name: "shopAuditDetails",
            meta: {
                title: '商品审核',
                authority:true
            },
            component: shopAuditDetails
        },
        {
            path: "/shop/goodPresent",
            name: "goodPresent",
            meta: {
                title: '好礼专区',
                authority:false
            },
            component: goodPresent
        },
        {
            path: "/shop/applyGoodShop",
            name: "applyGoodShop",
            meta: {
                title: '修改好礼',
                authority:true
            },
            component: applyGoodShop
        },
        {
            path: "/shop/editShop",
            name: "editShop",
            meta: {
                title: '修改商品',
                authority:true
            },
            component: editShop
        },
        {
            path: "/shop/shopOperation",
            name: "shopOperation",
            meta: {
                title: '好礼运营',
                authority:false
            },
            component: shopOperation
        },
        {
            path: "/shop/shopOperationNow",
            name: "shopOperationNow",
            meta: {
                title: '商品运营',
                authority:false
            },
            component: shopOperationNow
        },
        {
            path: "/shop/activityOperation",
            name: "activityOperation",
            meta: {
                title: '首页活动运营',
                authority:false
            },
            component: activityOperation
        },
        {
            path: "/shop/activityOperationSet",
            name: "activityOperationSet",
            meta: {
                title: '首页活动配置',
                authority:false
            },
            component: activityOperationSet
        },
        {
            path: "/shop/evaluate",
            name: "evaluate",
            meta: {
                title: '评价管理',
                authority:false
            },
            component: evaluate
        },
        {
            path: "/shop/evaluateList",
            name: "evaluateList",
            meta: {
                title: '评价记录',
                authority:true
            },
            component: evaluateList
        },
        {
          path: '/shop/commodityBrand',
          name: 'commodityBrand',
          component: () => import('./views/shop/commodityBrand'),
          meta:{title:'商品品牌信息',authority:false}
        },
        {
          path: '/shop/addCommodityBrand',
          name: 'addCommodityBrand',
          component: () => import('./views/shop/addCommodityBrand'),
          meta:{title:'商品品牌信息详情',authority:true}
        },
        /*订单查询*/
        {
            path: "/order/goodPresent",
            name: "goodPresentOrder",
            meta: {
                title: '好礼订单',
                authority:false
            },
            component: goodPresentOrder
        },
        {
            path: "/order/goodStore",
            name: "goodStore",
            meta: {
                title: '好店订单',
                authority:false
            },
            component: goodStore
        },
        {
            path: "/order/cloudWarehouse",
            name: "cloudWarehouse",
            meta: {
                title: '云仓订单',
                authority:false
            },
            component: cloudWarehouse
        },
        {
            path: "/order/scanQRCode",
            name: "scanQRCode",
            meta: {
                title: '扫码订单',
                authority:false
            },
            component: scanQRCode
        },
        {
            path: "/order/orderDetail",
            name: "orderDetail",
            meta: {
                title: '订单详情',
                authority:true
            },
            component: orderDetail
        },
        {
            path: "/statistics/ebaoOrderDetail",
            name: "ebaoOrderDetail",
            meta: {
                title: '易宝订单交易结算报表',
                authority:true
            },
            component: () => import('./views/statistics/ebaoOrderDetail')
        },
        {
            path: "/statistics/behavior",
            name: "behavior",
            meta: {
                title: '行为统计',
                authority:false
            },
            component: () => import('./views/statistics/userData/behavior')
        },
        {
            path: "/statistics/deal",
            name: "deal",
            meta: {
                title: '交易统计',
                authority:false
            },
            component: () => import('./views/statistics/userData/deal')
        },
        {
            path: "/statistics/userOrderDetail",
            name: "userOrderDetail",
            meta: {
                title: '用户订单明细',
                authority:true
            },
            component: () => import('./views/statistics/userData/userOrderDetail')
        },
        {
            path: "/statistics/houniaoStatistics",
            name: "houniaoStatistics",
            meta: {
                title: '候鸟分账报表',
                authority:false
            },
            component: () => import('./views/statistics/houniaoStatistics')
        },
        {
            path: "/statistics/integralStatistics",
            name: "integralStatistics",
            meta: {
                title: '积分统计报表',
                authority:false
            },
            component: () => import('./views/statistics/integralStatistics')
        },
        {
            path: "/statistics/orderStatistics",
            name: "orderStatistics",
            meta: {
                title: '订单统计',
                authority:false
            },
            component: () => import('./views/statistics/orderStatistics')
        },
        {
            path: "/statistics/userStatistics",
            name: "userStatistics",
            meta: {
                title: '用户统计',
                authority:false
            },
            component: () => import('./views/statistics/userStatistics')
        },
        {
            path: "/statistics/voucherDetails",
            name: "voucherDetails",
            meta: {
                title: '消费券明细',
                authority:false
            },
            component: () => import('./views/statistics/voucherDetails')
        },
        {
            path: "/order/cloudWarehouseOrderDetail",
            name: "cloudWarehouseOrderDetail",
            meta: {
                title: '云仓订单详情',
                authority:true
            },
            component: cloudWarehouseOrderDetail
        },
        /*用户管理*/
        {
            path: "/user/userManage",
            name: "userManage",
            meta: {
                title: '用户管理',
                authority:false
            },
            component: () => import('./views/user/userManage')
        },
        {
            path: "/user/userArea",
            name: "userArea",
            meta: {
                title: '管辖区域',
                authority:true
            },
            component: () => import('./views/user/userArea')
        },
        {
            path: "/user/joinApply",
            name: "joinApply",
            meta: {
                title: '加盟申请',
                authority:true
            },
            component: () => import('./views/user/joinApply')
        },
        {
            path: "/user/applyStore",
            name: "applyStore",
            meta: {
                title: '商家申请',
                authority:true
            },
            component: () => import('./views/user/applyStore')
        },
        {
            path: "/user/applyStoreNew",
            name: "applyStoreNew",
            meta: {
                title: '商家申请',
                authority:true
            },
            component: () => import('./views/user/applyStoreNew')
        },

        {
            path: "/user/userDetail",
            name: "userDetail",
            meta: {
                title: '用户详情',
                authority:true
            },
            component: () => import('./views/user/userDetail')
        },{
            path: "/user/addUser",
            name: "addUser",
            meta: {
                title: '添加用户',
                authority:true
            },
            component: () => import('./views/user/addUser')
        },
        {
            path: "/user/storeManage",
            name: "storeManage",
            meta: {
                title: '商家管理',
                authority:false
            },
            component: () => import('./views/user/storeManage')
        },
        {
            path: "/user/addStoreAccount",
            name: "addStoreAccount",
            meta: {
                title: '新增商家用户账号',
                authority:false
            },
            component: () => import('./views/user/addStoreAccount')
        },
        {
            path: "/user/userEarnings",
            name: "userEarnings",
            meta: {
                title: '用户收益',
                authority:false
            },
            component: () => import('./views/user/userEarnings')
        },
        {
            path: "/user/userWithdrawDeposit",
            name: "userWithdrawDeposit",
            meta: {
                title: '用户提现',
                authority:false
            },
            component: () => import('./views/user/userWithdrawDeposit')
        },
        {
            path: "/user/userIntegral",
            name: "userIntegral",
            meta: {
                title: '用户积分',
                authority:false
            },
            component: () => import('./views/user/userIntegral')
        },
        {
            path: "/user/blackList",
            name: "blackList",
            meta: {
                title: '黑名单列表',
                authority:false
            },
            component: () => import('./views/user/specialList')
        },
        {
            path: "/user/whiteList",
            name: "whiteList",
            meta: {
                title: '白名单列表',
                authority:false
            },
            component: () => import('./views/user/specialList')
        },
        {
            path: "/user/spreaderManager",
            name: "spreaderManager",
            meta: {
                title: '推广者管理',
                authority:false
            },
            component: () => import('./views/user/spreaderManager')
        },
        /*视频*/
        {
           path: "/video/videoSet",
           name: "videoSet",
           meta: {
               title: '视频管理',
               authority:false
           },
           component: () => import('./views/video/videoSet')
        },
        {
           path: "/video/upVideo",
           name: "upVideo",
           meta: {
               title: '上传视频',
               authority:true
           },
           component: () => import('./views/video/upVideo')
        },
        /*运营工具*/
        {
            path: "/operatingTools/activeShopList",
            name: "activeShopList",
            meta: {
                title: '消费券配置',
                authority:false
            },
            component: () => import('./views/operatingTools/activeShopList')
        },
        {
            path: "/operatingTools/activeShopListNew",
            name: "activeShopListNew",
            meta: {
                title: '模块列表',
                authority:false
            },
            component: () => import('./views/operatingTools/activeShopListNew')
        },
        {
            path: "/operatingTools/couponAllocation",
            name: "couponAllocation",
            meta: {
                title: '活动商品管理',
                authority:false
            },
            component: () => import('./views/operatingTools/couponAllocation')
        },
        {
            path: "/operatingTools/lotteryAllocation",
            name: "lotteryAllocation",
            meta: {
                title: '抽奖配置',
                authority:false
            },
            component: () => import('./views/operatingTools/lotteryAllocation')
        },
        {
            path: "/operatingTools/sendCouponAllocation",
            name: "sendCouponAllocation",
            meta: {
                title: '消费券发放配置',
                authority:false
            },
            component: () => import('./views/operatingTools/sendCouponAllocation')
        },
        {
            path: "/operatingTools/activityManagement",
            name: "activityManagement",
            meta: {
                title: '活动管理',
                authority:false
            },
            component: () => import('./views/operatingTools/activityManagement')
        },
        {
            path: "/operatingTools/homeActivityManagement",
            name: "homeActivityManagement",
            meta: {
                title: '商品模块管理',
                authority:false
            },
            component: () => import('./views/operatingTools/homeActivityManagement')
        },
        {
            path: "/operatingTools/activityManagementAdd",
            name: "activityManagementAdd",
            meta: {
                title: '创建活动',
                authority:true
            },
            component: () => import('./views/operatingTools/activityManagementAdd')
        },
        {
            path: "/operatingTools/shopOperation",
            name: "shopOperation",
            meta: {
                title: '商品运营',
                authority:false
            },
            component: () => import('./views/operatingTools/shopOperation')
        },
        {
            path: "/operatingTools/shopOperationDetail",
            name: "shopOperationDetail",
            meta: {
                title: '商品运营详情',
                authority:true
            },
            component: () => import('./views/operatingTools/shopOperationDetail')
        },
        {
            path: "/operatingTools/houniaoCategory",
            name: "houniaoCategory",
            meta: {
                title: '候鸟商品类目管理',
                authority:false
            },
            component: () => import('./views/operatingTools/houniaoCategory')
        },
        /*审核管理*/
        {
            path: "/audit/circleAudit",
            name: "circleAudit",
            meta: {
                title: '圈子审核',
                authority:false
            },
            component: () => import('./views/audit/circleAudit')
        },
        {
            path: "/audit/nameAttestationAudit",
            name: "nameAttestationAudit",
            meta: {
                title: '实名认证审核',
                authority:false
            },
            component: () => import('./views/audit/nameAttestationAudit')
        },
        {
            path: "/audit/storeAudit",
            name: "storeAudit",
            meta: {
                title: '商家审核',
                authority:false
            },
            component: () => import('./views/audit/storeAudit')
        },
        {
            path: "/audit/goodStore",
            name: "goodStore",
            meta: {
                title: '好店推广',
                authority:false
            },
            component: () => import('./views/audit/goodStore')
        },
        {
            path: "/audit/joinCompanyAudit",
            name: "joinCompanyAudit",
            meta: {
                title: '加盟审核',
                authority:true
            },
            component: () => import('./views/audit/joinCompanyAudit')
        },
        {
            path: "/audit/withdrawAudit",
            name: "withdrawAudit",
            meta: {
                title: '提现申请',
                authority:true
            },
            component: () => import('./views/audit/withdrawAudit')
        },
        {
            path: "/audit/upMoneyAudit",
            name: "upMoneyAudit",
            meta: {
                title: '提额申请',
                authority:true
            },
            component: () => import('./views/audit/upMoneyAudit')
        },
        {
            path: "/audit/joinApplyMsg",
            name: "joinApplyMsg",
            meta: {
                title: '加盟信息',
                authority:true
            },
            component: () => import('./views/audit/joinApplyMsg')
        },
        {
            path: "/audit/videoAudit",
            name: "videoAudit",
            meta: {
                title: '视频审核',
                authority:true
            },
            component: () => import('./views/audit/videoAudit')
        },
        {
            path: "/audit/integralAudit",
            name: "integralAudit",
            meta: {
                title: '积分兑换审核',
                authority:true
            },
            component: () => import('./views/audit/integralAudit')
        },
        {
            path: "/audit/spreaderAudit",
            name: "spreaderAudit",
            meta: {
                title: '推广者审核',
                authority:false
            },
            component: () => import('./views/audit/spreaderAudit')
        },
        /*广告管理*/
        {
            path: "/advertising/advertising",
            name: "advertising",
            meta: {
                title: '广告管理',
                authority:false
            },
            component: () => import('./views/advertising/advertising')
        },
        {
            path: "/advertising/addAdvertising",
            name: "addAdvertising",
            meta: {
                title: '添加广告',
                authority:true
            },
            component: () => import('./views/advertising/addAdvertising')
        },

        /*文章管理*/
        {
            path: "/article/article",
            name: "article",
            meta: {
                title: '文章管理',
                authority:false
            },
            component: () => import('./views/article/article')
        },
        /*消息通知*/
        {
            path: "/msg/taskManager",
            name: "taskManager",
            meta: {
                title: '文章管理',
                authority:false
            },
            component: () => import('./views/msg/taskManager')
        },
        {
            path: "/msg/feedback",
            name: "feedback",
            meta: {
                title: '意见反馈',
                authority:false
            },
            component: () => import('./views/msg/feedback')
        },
        {
            path: "/msg/pushMsg",
            name: "pushMsg",
            meta: {
                title: '消息推送',
                authority:false
            },
            component: () => import('./views/msg/pushMsg')
        },
        /*商家商户号*/
        {
            path: "/storeNumber/reg",
            name: "reg",
            meta: {
                title: '商户号注册',
                authority:false
            },
            component: () => import('./views/storeNumber/reg')
        },
        /*报表统计*/
        {
            path: "/statistics/storeMarket",
            name: "storeMarket",
            meta: {
                title: '商家销售报表',
                authority:false
            },
            component: () => import('./views/statistics/storeMarket')
        },
        {
            path: "/statistics/cloudMarket",
            name: "cloudMarket",
            meta: {
                title: '云仓销售报表',
                authority:false
            },
            component: () => import('./views/statistics/cloudMarket')
        },
        {
            path: "/statistics/ebaoCloudMarket",
            name: "ebaoCloudMarket",
            meta: {
                title: '云仓销售报表(易宝支付)',
                authority:false
            },
            component: () => import('./views/statistics/ebaoCloudMarket')
        },{
            path: "/statistics/recommendJoin",
            name: "recommendJoin",
            meta: {
                title: '推荐加盟报表',
                authority:false
            },
            component: () => import('./views/statistics/recommendJoin')
        },{
            path: "/statistics/orderDetail",
            name: "orderDetail",
            meta: {
                title: '订单交易结算报表',
                authority:false
            },
            component: () => import('./views/statistics/orderDetail')
        },{
            path: "/statistics/orderRefundDetail",
            name: "orderRefundDetail",
            meta: {
                title: '订单交易退款报表',
                authority:false
            },
            component: () => import('./views/statistics/orderRefundDetail')
        },{
            path: "/statistics/tradingRevenue",
            name: "tradingRevenue",
            meta: {
                title: '交易收益报表',
                authority:false
            },
            component: () => import('./views/statistics/tradingRevenue')
        },{
            path: "/statistics/cloudEarnings",
            name: "cloudEarnings",
            meta: {
                title: '云仓总收益',
                authority:false
            },
            component: () => import('./views/statistics/cloudEarnings')
        },{
            path: "/statistics/platformEarnings",
            name: "platformEarnings",
            meta: {
                title: '平台总收益',
                authority:false
            },
            component: () => import('./views/statistics/platformEarnings')
        },{
            path: "/statistics/promotionDetail",
            name: "promotionDetail",
            meta: {
                title: '推广交易明细',
                authority:true
            },
            component: () => import('./views/statistics/promotionDetail')
        },{
            path: "/statistics/userWithdraw",
            name: "userWithdraw",
            meta: {
                title: '用户提现报表',
                authority:false
            },
            component: () => import('./views/statistics/userWithdraw')
        },{
            path: "/statistics/singleJoinDetail",
            name: "singleJoinDetail",
            meta: {
                title: '推荐加盟明细报表',
                authority:true
            },
            component: () => import('./views/statistics/singleJoinDetail')
        },
        {
            path: "/projectConfig/fromConfig",
            name: "fromConfig",
            meta: {
                title: '表单配置',
                authority:false
            },
            component: fromConfig
        },
        {
            path: "/projectConfig/addFrom",
            name: "addFrom",
            meta: {
                title: '发布表单',
                authority:true
            },
            component: () => import('./views/projectConfig/addFrom')
        },
        {
            path: "/projectConfig/lookFrom",
            name: "lookFrom",
            meta: {
                title: '查看表单',
                authority:true
            },
            component: () => import('./views/projectConfig/lookFrom')
        },
				{
				  path: '/404',
				  name: '404',
          meta: {
              title: '404',
              authority:true
          },
				  component: NotFound
				},

      ]
    },
    {
      path: '/login',
    	name:'login',
      component: Login
    },
    {
      path: '/register',
    	name:'register',
    	component: Register
    },
    {
      path: '*',
      redirect: { path: '/404' }
    }
  ]
})
//console.log(store.state.menuList);

/*刷新页面权限设置*/
let menuStatusList = [];/*有权限的页面*/
let menuList = store.state.menuList.length?JSON.parse(store.state.menuList):[];
for(let i=0;i<menuList.length;i++){
  if(menuList[i].children){
    for(let a = 0;a<menuList[i].children.length;a++){
      menuStatusList.push(menuList[i].children[a])
        if(menuList[i].children[a].children){
           for(let b = 0;b<menuList[i].children[a].children.length;b++){
             menuStatusList.push(menuList[i].children[a].children[b])
           }
        }
    }
  }

}
for(let a=0;a<router.options.routes[0].children.length;a++){
  for(let i=0;i<menuStatusList.length;i++){
    if(router.options.routes[0].children[a].path == menuStatusList[i].index){
      router.options.routes[0].children[a].meta.authority = true;
    }
  }
}
/*刷新页面权限设置*/

// 全局路由守卫
router.beforeEach((to, from, next) => {
  let isAuthority = to.meta.authority;//是否有权限进入该页面
  const nextRoute = [ 'login', 'register'];//不需要登入权限的页面
	if (!(nextRoute.indexOf(to.name) >= 0)){  // 判断该路由是否需要登录权限
		const LOGINURL = '/login';
		let url = to.path;
		let user = localStorage.getItem('bossAppToken');
		if (url === LOGINURL) {
			localStorage.removeItem('bossAppToken')
		}
		// 判断是否登录
		if (!user && url !== LOGINURL) {
			next({ path: LOGINURL })
		}else if(url=='/' && user){
      next({path: '/dashboard'})
    }else if(!isAuthority){
      next({path: '/404'})
    }else {
			next()
		}
	}else{
		next()
	}
})

export default router
